﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace learnCsharpwinform
{
    class BotNode
    {
        public static readonly TreeNode RootNode= new TreeNode("编程区");
        public static int NodeAmount=1;
        public static int NodeCount = 100;
        public static int CurrentNode = 1;
       
       // public static double[,] Road_Points=new double[100,100];
        public static List<double[]> RoadPoints = new List<double[]>();

        public BotNode(double[] NodePosition,string node_name,TreeNode node_parent)
        {
            name = node_name;
            num = NodeAmount;
            parent = node_parent;
            node = new TreeNode(name);
            node.Tag = NodePosition;
            generate_node();

        }

        private double[] NodePosition = new double[6];
        private int num;
        private string name;
        private TreeNode node;
        private TreeNode parent;
        private void generate_node()
        {
            if (parent == null)
            { RootNode.Nodes.Add(node);}
            else
            { parent.Nodes.Add(node);}
        }

        public static void ClearColor()
        {
            foreach (TreeNode i in RootNode.Nodes)
            { i.BackColor = Color.Transparent; }
        }
        public static void DeleteNode(int i)
        {
            RoadPoints.RemoveAt(i - 1);
            NodeAmount -= 1;
        }


    }
    class Programs
    {
        private static int CurrentNode=0;


        public void MoveBySequence(bot robot,Timer wait)
        {
         
            for (int i=0;i<BotNode.NodeAmount-1;i++)
            {
                robot.movebot(BotNode.RoadPoints[i],wait);
                while (wait.Enabled);
            }
        }

    }
}
